﻿using System;
using System.Collections.Generic;
using System.Text;

namespace VIP.Domain
{
    /// <summary>
    /// 数据库连接字符串
    /// </summary>
    public class DBConnectionOptions
    {
        public const string OptionsSectionName = "ConnectionStrings";
        /// <summary>
        /// 主库（读写库）连接字符串
        /// </summary>
        public string SQL_ReadAndWrite { get; set; }
        /// <summary>
        /// 从库连接字符串
        /// </summary>
        public string SQL_Read { get; set; }
    }

    /// <summary>
    /// 核心配置
    /// </summary>
    public class DomainOptions
    {
        public const string OptionsSectionName = "DomainOptions";
        /// <summary>
        /// 是否缓存聚合根
        /// </summary>
        public bool LoadObjFromCache { get; set; }
        /// <summary>
        /// 订单缓存前缀
        /// </summary>
        public string OrderCachePrefix { get; set; }
    }

    /// <summary>
    /// 缓存配置
    /// </summary>
    public class EasycachingOptions
    {
        public const string OptionsSectionName = "easycaching";
        public Inmemory inmemory { get; set; }
        public Redis redis { get; set; }
        public class Inmemory
        {
            public int CachingProviderType { get; set; }
            public int MaxRdSecond { get; set; }
            public int Order { get; set; }
        }
        public class Redis
        {
            public int CachingProviderType { get; set; }
            public int MaxRdSecond { get; set; }
            public int Order { get; set; }
            public int Database { get; set; }
            public Redis_dbconfig dbconfig { get; set; }
        }
        public class Redis_dbconfig
        {
            public int Password { get; set; }
            public bool IsSsl { get; set; }
            public string SslHost { get; set; }
            public int ConnectionTimeout { get; set; }
            public bool AllowAdmin { get; set; }
            public Redis_dbconfig_Endpoints[] Endpoints { get; set; }
        }
        public class Redis_dbconfig_Endpoints
        {
            public string Host { get; set; }
            public int Port { get; set; }
        }
    }
}
